﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace T09TypeChang
{
    class Program
    {
        static void Main(string[] args)
        {
            //隐式类型转换
            double d = 10.23f;
            //显式类型转换 又称为强制类型转换
            int a = (int)d;
            Console.WriteLine($"强制类型转换：{a}");

            Console.WriteLine("==================");

            //字符串与数值之间的转换
            string strNumber = "123";
            int iC = int.Parse(strNumber);
            //int iC=Int32.Parse(strNumber);
            Console.WriteLine($"字符串类型转换：{iC}");

            //int iD = int.Parse("123");
            //out int_iD;
            //bool bD= int iC Parse("123s",out_iD);

            //转换类
            int iE = Convert.ToInt32("12");
            Console.WriteLine($"Convert类转换字符串{iE}");

            //数值转换字符串
            Console.WriteLine($"数值转换字符串{12.ToString()}");

            Console.WriteLine("==================");

        }
    }
}

    /*abstract class Animal
    {
        public abstract void walk();

        public void Eat()
        {
            Console .WriteLine("吃")
        }
    }
    class Cock :Animal
    {
        Console.WriteLine("公鸡报晓")

    }
}*/
